var base64 = require("../img/base64");
Page({
  data:{
    icon :'',
    userinfo:null,
    istrue:false,
    showDialog: false,
    date:new Date().toLocaleDateString
  },
  onLoad: function () {
    var _this = this
    this.setData({
      icon: base64.icon20
    });
    wx.getUserInfo({
      withCredentials: false,
      lang: 'zh_CN',
      success: function(res) {
        _this.setData({
          userinfo:res.userInfo
        })
        console.log(_this.data.userinfo)
      },
      fail: function(res) {},
      complete: function(res) {},
    })
  },
  openDialog: function () {
    this.setData({
      istrue: true
    })
  },
  closeDialog: function () {
    this.setData({
      istrue: false
    })
  },
  bindDateChange: function (e) {
    this.setData({
      date: e.detail.value
    })
  },
  login(){
    wx.login({
      success(res) {
        if (res.code) {
          //发起网络请求
          wx.request({
            url: 'https://bo.free.idcfengye.com/EasyAdmin/user/WxMiniProLogin',
            data: {
              code: res.code
            }
          })
        } else {
          console.log('登录失败！' + res.errMsg)
        }
      }
    })
  }
});